{extends file="../global.html"}
{block name=body}

<div class="content" >
  <!-- 右侧内容框架，更改从这里开始 -->
  <form class="layui-form xbs" action="{url('/run/type/index')}" method="get">
      <div class="layui-form-pane" style="text-align: center;">
        <div class="layui-form-item" style="display: inline-block;">
          <!-- <label class="layui-form-label xbs768">日期范围</label>
          <div class="layui-input-inline xbs768">
            <input class="layui-input" placeholder="开始日" id="LAY_demorange_s">
          </div>
          <div class="layui-input-inline xbs768">
            <input class="layui-input" placeholder="截止日" id="LAY_demorange_e">
          </div> -->
          <div class="layui-input-inline">
            <input type="text" name="type_name"  placeholder="请输入车系名" autocomplete="off" class="layui-input">
          </div>
          <div class="layui-input-inline" style="width:80px">
              <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
          </div>
        </div>
      </div> 
  </form>
  <xblock><span class="x-right" style="line-height:40px">共有数据： 条</span></xblock>
  <table class="layui-table">
      <thead>
          <tr>
              <th>
                  <input type="checkbox" name="" value="">
              </th>
              <th>
                  goods_id
              </th>
              <th>
                 所属车系名
              </th>
              <th>
                  亮点图片
              </th>
              <th>
                 亮点标题
              </th>

              <th>
                 亮点内容
              </th>
              <th>
				          操作
              </th>
          </tr>
      </thead>
      <tbody>
      {foreach $res as $value}
          <tr class="car_{$value.car_id}">
              <td>
                  <input type="checkbox" value="1" name="">
              </td>
              <td>
                 {$value.goods_id}
              </td>
              <td>
            {$value.goods_name}
              </td>
              
          
              <td>
                  <img src="{$absroot}{$value.car_img}" alt="" width="70">
              </td>
				<td>
            {$value.car_title}
				</td>
				  <td>
					   {$value.car_content|truncate:60}
              </td>
              <td class="td-manage">
                  
                  <a title="编辑" href="{url('/run/highlights/edit/id/'|cat:$value.car_id)}"
                            class="ml-5" style="text-decoration:none">
                                <i class="layui-icon">&#xe642;</i>
                  </a>
                <a title="删除" href="javascript:del({$value.car_id},{$value.goods_id})"  
                            style="text-decoration:none">
                 
                      <i class="layui-icon">&#xe640;</i>
                  </a>
              </td>
            
          </tr>
         {/foreach}
      </tbody>
      

  </table>
  <script type="text/javascript">

             function del(carid,goodsid){
                    if(confirm('确定要删除？')==true){
                       $.ajax({
                        type:"post",
                        data:{ carid:carid,goods_id:goodsid},
                        url:"{url('run/highlights/ajaxDel')}",
                        success:function(msg){
                          // alert(msg);
                            if(msg==2){
                                 $('.car_'+carid).remove();        
                            }else if(msg==1){
                           
                                alert('删除失败');
                            }else if(msg ==0){
                                alert('不能再删除了哟');
                            }
                         },
                         error:function(){
                                
                        }

                     })
                    }
              }
  </script>
{/block}